package top.linyuxb.lycloud.common.mapper;

import org.springframework.jdbc.core.RowMapper;
import top.linyuxb.lycloud.common.po.LyConfigServerPo;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by Intellij IDEA.
 *
 * @Author: linyuxb
 * @Date: 2024/6/17 14:21
 * @Desc:
 */
public class LyConfigServerMapper implements RowMapper<LyConfigServerPo> {
    @Override
    public LyConfigServerPo mapRow(ResultSet rs, int rowNum) throws SQLException {
        return LyConfigServerPo.builder()
                .id(rs.getLong("id"))
                .env(rs.getString("env"))
                .app(rs.getString("app"))
                .serverIp(rs.getString("server_ip"))
                .serverPort(rs.getString("server_port"))
                .user(rs.getString("user"))
                .userPassword(rs.getString("user_password"))
                .active(rs.getTimestamp("active"))
                .weight(rs.getInt("weight"))
                .status(rs.getInt("status"))
                .creatorId(rs.getLong("creator_id"))
                .lastModifierId(rs.getLong("last_modifier_id"))
                .ctime(rs.getTimestamp("ctime"))
                .utime(rs.getTimestamp("utime"))
                .build();
    }
}
